Xbasic

SELECTLIST Function

Syntax

Output_Value as A = SELECTLIST(N index,A value_1,[A value]...)

Arguments

index

An integer ranging from 1 to N that selects Value1 to ValueN. Numeric

value_1

Any type of value expression.

value

Any type

Description

Selects value from list of parameters based on index (1 for first value,2 for second etc). Values can be mixed types, a NIL is returned if none match.

Discussion

SELECTLIST() returns the value indicated by the Index parameter. The primary use of SELECTLIST() is in Calc Fields. It is easier to use than a group of nested IIF()statements and is simpler to use than a SELECT CASE function.

Example

? selectlist(1, "red", "green", "blue")
= "red"
? selectlist(3, "red", "green", "blue")
= "blue"

See Also